package datatypes;

import java.util.ArrayList;

public class Ware {
	private String name;
	private int stufe;
	private ArrayList<String> verkaufsorte;
	
	public Ware(String name, int level) {
		super();
		this.name = name;
		this.stufe = level;
		this.verkaufsorte = new ArrayList<String>();
	}
	
	public Ware(String name){
		super();
		this.name = name;
		this.stufe = -1;
		this.verkaufsorte = new ArrayList<String>();
	}

	public String getName() {
		return name;
	}

	public int getStufe() {
		return stufe;
	}

	public ArrayList<String> getVerkaufsorte() {
		return verkaufsorte;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setStufe(int stufe) {
		this.stufe = stufe;
	}

	public void setVerkaufsorte(ArrayList<String> verkaufsorte) {
		this.verkaufsorte = verkaufsorte;
	}
	
	public void addVerkaufsort(String cityname){
		this.verkaufsorte.add(cityname);
	}
	
	public boolean containsVerkaufsort(String cityname){
		return this.verkaufsorte.contains(cityname);
	}

	@Override
	public String toString() {
		return getName() + " - " + getVerkaufsorte();
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Ware other = (Ware) obj;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
	
	
}
